import { TagSelectNew as TagSelect } from '@/components/TagSelectNew';
import { SearchOutlined, EyeOutlined } from '@ant-design/icons';
import { AutoComplete, DatePicker, Form, Tooltip, message, Input, InputNumber } from 'antd';
import { calculate } from '../common/Format';
import { downloadTemplate, getColorTextLoadMap, getFileNameNotType, getLoadMapList, getSelectDataCommon, getTenantID, splitFileUrl } from '@/utils';
import { ILoadMapTypeAll } from '@/common';
import MyIcon from '@/components/MyIcon';
import moment from 'moment';
import { RegularExpression } from '@/common/constVariable';
import { BJCS, BJKJ, BJXJ, DYLY, formatDecimal, GKZB, JZXCS, JZXTP, KJXYCG, renderFileFunc, SYSZX, XJCG, ZFJZCG } from '../../Acommon';
import { UploadFormCommon } from '@/components/UploadForm';
import { useMemo } from 'react';

export const ColumnsUpdateConfig = ({ change, state, cardType, formRef }) => {
  // 外层数据
  const { radioState, infoState, industry_involveds } = state;
  const { changeRadio, setIsShow, handleDelFileFn, handleAddFileFn, changeInfo } = change;

  let tableType;
  if (infoState?.id && infoState?.procureOrg == SYSZX()) {
    //实验室自行组织采购
    tableType = infoState?.procureReal;
  } else if (infoState?.id && infoState?.procureOrg == ZFJZCG()) {
    //政府集中采购
    tableType = GKZB();
  }

  /** 评标方法 */
  const PBFF = [
    {
      value: `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1002`,
      name: '综合评分法',
    },
    {
      value: `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1003`,
      name: '最低评标价法',
    },
  ];

  /** 第一阶段入围供应商评审方法 */
  const DYJD = [
    {
      value: `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1000`,
      name: '质量优先法',
    },
    {
      value: `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1001`,
      name: '价格优先法',
    },
  ];

  /** 项目属性list */
  const supplyTypeList = [
    {
      value: '1',
      name: '货物类',
    },
    {
      value: '0',
      name: '服务类',
    },
  ];

  let disabled = false;

  if (cardType == 'view') disabled = true;
  if (cardType == 'edit') disabled = false;

  let columns = [
    {
      key: 'BasicInformation',
      title: '基本信息',
      fieldChildren: [
        {
          label: '标包名称',
          field: 'packName',
          component: 'Input',
          disabled: true,
          placeholder: disabled ? '--' : '请输入',
        },
        {
          label: '包号',
          field: 'packCode',
          component: 'Input',
          disabled: true,
          placeholder: disabled ? '--' : '请输入',
        },
        {
          label: '承办人',
          field: 'ownerName',
          component: 'Input',
          placeholder: disabled ? '--' : '请输入',
          disabled: true,
          colSpan: 1,
        },
        {
          label: '联系电话',
          field: 'ownPhone',
          component: 'Input',
          placeholder: disabled ? '--' : '请输入',
          disabled,
          colSpan: 1,
        },
        {
          label: '所属行业',
          field: 'industryKind',
          component: 'Select',
          fieldNames: { label: 'name', value: 'value' },
          options: industry_involveds || [
            {
              name: '农、林、牧、渔业，工业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1000`,
            },
            {
              name: '建筑业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1001`,
            },
            {
              name: '批发业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1002`,
            },
            {
              name: '零售业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1003`,
            },
            {
              name: '交通运输业（不含铁路运输业）',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1004`,
            },
            {
              name: '仓储业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1005`,
            },
            {
              name: '住宿业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1006`,
            },
            {
              name: '餐饮业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1007`,
            },
            {
              name: '信息传输业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1008`,
            },
            {
              name: '软件和信息技术服务业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1009`,
            },
            {
              name: '房地产开发经营',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1010`,
            },
            {
              name: '物业管理',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1011`,
            },
            {
              name: '租赁和商务服务业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1012`,
            },
            {
              name: '其他未列明行业',
              value: `${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}1013`,
            },
          ],
          placeholder: disabled ? '--' : '请选择',
          required: true,
          disabled,
        },
        {
          label: '项目属性',
          field: 'supplyTypeName',
          component: 'Render',
          placeholder: disabled ? '--' : '请选择',
          slotRender: (text) => {
            const { colorText } = getColorTextLoadMap(text);
            return <span style={{ marginLeft: '8px' }}>{colorText}</span>;
          },
        },
        {
          label: '预算金额',
          field: 'expectSum',
          component: 'InputNumber',
          placeholder: disabled ? '--' : '请输入',
          formatter: (value: number) => {
            if (value) {
              return Number(value).toFixed(2);
            }
          },
          contentAfter: '元',
          disabled: true,
        },
        {
          label: '最高限价',
          field: 'expectCeilSum',
          component: 'InputNumber',
          placeholder: disabled ? '--' : '请输入',
          min: 1,
          step: '0.01',
          contentAfter: '元',
          disabled,
          required: true,
          ishidden: infoState?.procureOrg == ZFJZCG() ? true : false,
          slotRender: () => {
            let { expectSum, expectCeilSum } = radioState;
            // 当超出预算金额时提示
            let ishow = false;
            if (expectCeilSum !== null && expectSum) ishow = Number(expectCeilSum) <= Number(expectSum) ? false : true;
            return (
              <>
                <div style={{ display: 'flex', alignItems: 'center', height: '100%', width: '100%' }}>
                  <div style={{ display: 'flex', flexDirection: 'column', height: '100%', flex: 'auto', justifyContent: 'center' }}>
                    {disabled ? (
                      <div style={{ paddingLeft: 8 }}>{formatDecimal(expectCeilSum)}</div>
                    ) : (
                      <Form.Item name={'expectCeilSum'} rules={[{ required: true, message: '请输入最高限价' }]}>
                        <InputNumber
                          status={ishow ? 'error' : ''}
                          bordered={ishow ? true : false}
                          value={expectCeilSum}
                          placeholder={disabled ? '--' : '请输入'}
                          controls={false}
                          style={{ paddingLeft: '5px' }}
                          onChange={(value: any) => {
                            changeRadio(value, 'expectCeilSum');
                            changeInfo(value, 'expectCeilSum');
                          }}
                        />
                      </Form.Item>
                    )}
                    {ishow && <span style={{ color: 'red', flex: '.5', paddingLeft: 8, fontSize: '14px' }}>不能超过预算金额</span>}
                  </div>
                  <div
                    style={{
                      minWidth: '43px',
                      maxWidth: '100px',
                      height: '100%',
                      color: 'rgba(0, 0, 0, 0.85)',
                      display: 'flex',
                      alignItems: 'center',
                      justifyContent: 'center',
                      borderLeft: '1px solid #f0f0f0',
                      backgroundColor: '#fafafa',
                      cursor: 'pointer',
                    }}
                  >
                    元
                  </div>
                </div>
              </>
            );
          },
        },
        {
          label: '采购组织形式',
          field: 'procureOrg',
          component: 'Input',
          disabled: true,
          placeholder: '--',
        },
        {
          label: '拟采用采购方式',
          field: 'procureReal',
          component: 'Input',
          disabled: true,
          placeholder: '--',
        },

        {
          label: '投标有效期',
          field: disabled ? 'Render' : 'bidPeriodDay',
          placeholder: disabled ? '--' : '请选择',
          component: 'Render',
          required: true,
          colSpan: radioState?.supplyType == 0 ? 1 : 2,
          ishidden: infoState?.procureOrg == ZFJZCG() ? true : false,
          slotRender: (text) => {
            return (
              <>
                <div className="criteria-btnStyle">
                  <div style={{ flex: 'auto', alignItems: 'center' }}>
                    <Form.Item
                      name={'bidPeriodDay'}
                      className={'formItem-bidPeriodDay'}
                      rules={[
                        {
                          required: true,
                          message: '请选择投标有效期',
                        },
                        {
                          pattern: RegularExpression.integerNumber,
                          message: '输入的投标有效期必须是正整数',
                        },
                      ]}
                    >
                      <AutoComplete
                        value={text}
                        disabled={disabled}
                        placeholder={disabled ? '--' : '请选择'}
                        defaultValue={'60'}
                        options={[
                          {
                            label: '60',
                            value: '60',
                          },
                          {
                            label: '90',
                            value: '90',
                          },
                          {
                            label: '120',
                            value: '120',
                          },
                        ]}
                      />
                    </Form.Item>
                  </div>
                  <div className="criteria-btnStyle-bottomIcon">日</div>
                </div>
              </>
            );
          },
        },
        {
          label: '是否科研仪器设备',
          field: 'sciequipFlag',
          component: 'Render',
          colSpan: radioState?.supplyType == 0 ? 1 : 0,
          required: true,
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '是';
            } else {
              name = '否';
            }

            if (disabled) {
              return <span style={{ paddingLeft: 8 }}>{name}</span>;
            } else {
              return (
                <TagSelect
                  colSpan={24}
                  formLabel={''}
                  formName={'sciequipFlag'}
                  defalultKeys={Number(text)}
                  radioList={[
                    {
                      value: 1,
                      name: '是',
                    },
                    {
                      value: 0,
                      name: '否',
                    },
                  ]}
                  radioDisabled={disabled}
                />
              );
            }
          },
        },
        {
          label: '是否接受进口',
          field: 'importFlag',
          component: 'Render',
          colSpan: radioState?.supplyType == 0 ? 1 : 0,
          required: true,
          slotRender: (text: string = '0', record: Record<string, any>) => {
            let name = '';
            if (text == '1') {
              name = '是';
            } else {
              name = '否';
            }

            if (disabled) {
              return <span style={{ paddingLeft: 8 }}>{name}</span>;
            } else {
              return (
                <TagSelect
                  colSpan={24}
                  formLabel={''}
                  formName={'importFlag'}
                  defalultKeys={Number(text)}
                  radioList={[
                    {
                      value: 1,
                      name: '是',
                    },
                    {
                      value: 0,
                      name: '否',
                    },
                  ]}
                  radioDisabled={disabled}
                />
              );
            }
          },
        },
        {
          label: '是否单一产品采购项目',
          field: 'productFlag',
          component: 'Render',
          required: true,
          colSpan: radioState?.supplyType == 0 ? (radioState.productFlag == 0 || radioState.productFlag == null ? 1 : 1) : 0,
          slotRender: (text: any = 0) => {
            let name = '';
            if (text == '1') {
              name = '是';
            } else {
              name = '否';
            }
            if (disabled) {
              return <span style={{ paddingLeft: 8 }}>{name}</span>;
            } else {
              return (
                <TagSelect
                  colSpan={24}
                  formLabel={''}
                  formName={'productFlag'}
                  onChange={(value) => {
                    changeRadio(value, 'productFlag');
                  }}
                  defalultKeys={Number(text)}
                  radioList={[
                    {
                      value: 1,
                      name: '是',
                    },
                    {
                      value: 0,
                      name: '否',
                    },
                  ]}
                  radioDisabled={disabled}
                />
              );
            }
          },
        },
        {
          label: '核心产品',
          field: 'productName',
          component: 'Input',
          placeholder: disabled ? '--' : '请输入',
          disabled,
          required: true,
          colSpan: radioState?.supplyType == 0 ? (radioState.productFlag == 0 || radioState.productFlag == null ? 0 : 1) : 0,
          ishidden: radioState?.supplyType == 0 ? (radioState.productFlag == 0 || radioState.productFlag == null ? true : false) : true,
        },
      ],
    },
    {
      key: 'SubcontractingRequirement',
      title: '分包要求',
      ishidden: tableType == BJKJ() || tableType == BJXJ() || tableType == BJCS() || tableType == KJXYCG(),
      fieldChildren: [
        {
          label: '分包',
          field: 'packFlag',
          component: 'Render',
          colSpan: 2,
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '允许';
            } else {
              name = '不允许';
            }

            return (
              <>
                {disabled ? (
                  <span style={{ paddingLeft: 8 }}>{name}</span>
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'packFlag'}
                    onChange={(value) => {
                      changeRadio(value, 'packFlag');
                    }}
                    radioDisabled={disabled}
                    defalultKeys={Number(text)}
                    radioList={[
                      {
                        value: 1,
                        name: '允许',
                      },
                      {
                        value: 0,
                        name: '不允许',
                      },
                    ]}
                  />
                )}
              </>
            );
          },
        },
        {
          label: '允许分包的比例',
          field: 'packScale',
          component: 'InputNumber',
          placeholder: disabled ? '--' : '请输入',
          type: 'number',
          min: 0,
          max: 100,
          step: '0.01',
          colSpan: radioState.packFlag == 0 ? 0 : 1,
          ishidden: radioState.packFlag == 0 ? true : false,
          contentAfter: '%',
          disabled,
          required: true,
        },
        {
          label: '允许分包的金额',
          field: 'packScale1',
          component: 'Render',
          placeholder: '根据分包比例自动算出',
          disabled: true,
          colSpan: radioState.packFlag == 0 ? 0 : 1,
          ishidden: radioState.packFlag == 0 ? true : false,
          contentAfter: '元',
          slotRender: (text, record) => {
            return <div style={{ marginLeft: '8px' }}>{calculate(Number(record?.expectSum), Number(record?.packScale))}</div>;
          },
          required: true,
        },
        {
          label: '可以分包履行的具体内容',
          field: 'packContent',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          maxLength: 200,
          autoSize: { minRows: 3, maxRows: 4 },
          colSpan: radioState.packFlag == 0 ? 0 : 2,
          ishidden: radioState.packFlag == 0 ? true : false,
          required: true,
          disabled,
          allowClear: true,
          showCount: true,
        },
        {
          label: '分包其他要求',
          field: 'packOther',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          maxLength: 200,
          autoSize: { minRows: 3, maxRows: 4 },
          colSpan: radioState.packFlag == 0 ? 0 : 2,
          ishidden: radioState.packFlag == 0 ? true : false,
          required: true,
          disabled,
          allowClear: true,
          showCount: true,
        },
      ],
    },
    {
      key: 'SupplierRequirement',
      title: '投标人/供应商要求',
      fieldChildren: [
        {
          label: '是否接受联合体',
          field: 'complexFlag',
          component: 'Render',
          colSpan: 2,
          required: true,
          ishidden: tableType == DYLY(),
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '是';
            } else {
              name = '否';
            }
            return (
              <>
                {disabled ? (
                  <span style={{ paddingLeft: 8 }}>{name}</span>
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'complexFlag'}
                    defalultKeys={Number(text)}
                    radioList={[
                      {
                        value: 1,
                        name: '是',
                      },
                      {
                        value: 0,
                        name: '否',
                      },
                    ]}
                    radioDisabled={disabled}
                  />
                )}
              </>
            );
          },
        },
        {
          label:
            tableType == BJKJ() || tableType == BJXJ() || tableType == BJCS() || tableType == KJXYCG() || tableType == DYLY() || tableType == JZXCS()
              ? '供应商特定资格要求'
              : '投标人特定资格要求',
          field: 'sourceContent',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          maxLength: 200,
          allowClear: true,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          colSpan: 2,
          disabled,
          required: true,
        },
      ],
    },
    {
      key: 'BidEvaluationMethods',
      title: '评标方法及标准',
      ishidden: tableType == BJXJ() || tableType == DYLY() || tableType == XJCG() || tableType == JZXTP(),
      fieldChildren: [
        {
          label: '评标方法',
          field: 'evalStyle',
          component: 'Render',
          ishidden: tableType == BJKJ() || tableType == BJCS() || tableType == KJXYCG(),
          colSpan: radioState?.evalStyle == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1003` ? 2 : 1,
          slotRender: (text: string = `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1002`) => {
            // let name = <span style={{ paddingLeft: 8, color: '#ccc' }}>--</span>;
            // if (text == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1002`) {
            //   name = <span style={{ paddingLeft: 8 }}>综合评分法</span>;
            // } else if (text == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1003`) {
            //   name = <span style={{ paddingLeft: 8 }}>最低评标价法</span>;
            // }

            let name = <span style={{ paddingLeft: 8 }}>综合评分法</span>;
            if (text == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1003`) {
              name = <span style={{ paddingLeft: 8 }}>最低评标价法</span>;
            }

            return (
              <>
                {disabled ? (
                  name
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'evalStyle'}
                    onChange={(value) => {
                      changeRadio(value, 'evalStyle');
                    }}
                    defalultKeys={text}
                    radioList={PBFF}
                    radioDisabled={disabled}
                  />
                )}
              </>
            );
          },
        },
        {
          label: '评分标准',
          field: 'evalFileURL',
          placeholder: '请选择',
          component: 'Render',
          required: true,
          colSpan:
            tableType == BJKJ() || tableType == BJCS() || tableType == KJXYCG()
              ? 2
              : radioState.evalStyle == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1003`
              ? 0
              : 1,
          ishidden:
            tableType == BJKJ() || tableType == BJCS() || tableType == KJXYCG()
              ? false
              : radioState.evalStyle == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1003`
              ? true
              : false,
          slotRender: (text) => {
            let fileName = 'evalFileURL';
            return (
              <div className="criteria-btnStyle">
                <div style={{ flex: 'auto', alignItems: 'center', padding: '5px 0' }}>
                  {!disabled ? (
                    <div style={{ width: 'fit-content' }}>
                      <UploadFormCommon
                        form={formRef}
                        fileFormName={fileName}
                        spanCol={24}
                        inRowProportion={24}
                        name={'attachFile'}
                        required={true}
                        accept={'.doc|.docx'}
                        url={'/purchaseSourceController/uploadFile'}
                        downloadUrl={'/purchaseSourceController/downloadFile'}
                        fileFormDelName={'delFile'}
                        delFunc={(delFilePath: string) => {
                          handleDelFileFn(delFilePath, fileName);
                        }}
                        uploadSuccessCallback={(attachPaths) => {
                          handleAddFileFn(attachPaths, fileName);
                        }}
                        defaultFiles={text}
                        maxFile={1}
                        hintTitle={'且只能上传 1 个！'}
                        fieldBusiPath={'purchase/source'}
                        // isShowUploadBtn={true}
                      >
                        上传
                      </UploadFormCommon>
                    </div>
                  ) : (
                    <div
                      style={{
                        height: '100%',
                        display: 'flex',
                        alignItems: 'center',
                        marginLeft: '8px',
                      }}
                    >
                      {radioState?.[fileName] ? (
                        splitFileUrl(radioState?.[fileName])?.map((e) => {
                          return (
                            <Tooltip title={e.attachName} key={new Date().getTime() * 25615265152 + e?.attachName}>
                              <a
                                onClick={() => {
                                  message.success('下载中，请稍后...');
                                  downloadTemplate('/purchaseSourceController/downloadFile', e?.attachName, e?.attachUrl, () => {});
                                }}
                              >
                                <MyIcon type="icon-file-text-fill" />
                                &nbsp;
                                {getFileNameNotType(e.attachName, 8)}
                              </a>
                            </Tooltip>
                          );
                        })
                      ) : (
                        <span style={{ color: '#ccc' }}>--</span>
                      )}
                    </div>
                  )}
                </div>
                {/* <div className="criteria-btnStyle-bottomIcon">
                  <a onClick={() => {}}>
                    <Tooltip title={`下载模板`}>
                      <VerticalAlignBottomOutlined />
                    </Tooltip>
                  </a>
                </div> */}
              </div>
            );
          },
        },
        {
          label: '第一阶段入围供应商数量',
          field: 'supplierMinNum',
          component: 'InputNumber',
          placeholder: disabled ? '--' : '请输入',
          ishidden: tableType == BJKJ() || tableType == KJXYCG() ? false : true,
          colSpan: 2,
          disabled,
        },
        {
          label: '第一阶段入围供应商评审方法',
          field: 'evalStyle',
          component: 'Render',
          colSpan: 2,
          ishidden: tableType == BJKJ() || tableType == KJXYCG() ? false : true,
          slotRender: (text: string = `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1000`) => {
            let name = <span style={{ paddingLeft: 8, color: '#ccc' }}>--</span>;
            if (text == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1000`) {
              name = <span style={{ paddingLeft: 8 }}>质量优先法</span>;
            } else if (text == `${getTenantID()}${ILoadMapTypeAll?.EVALSTYLE_TYPE}1001`) {
              name = <span style={{ paddingLeft: 8 }}>价格优先法</span>;
            }

            return (
              <>
                {disabled ? (
                  name
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'evalStyle'}
                    onChange={(value) => {
                      changeRadio(value, 'evalStyle');
                    }}
                    defalultKeys={text}
                    radioDisabled={disabled}
                    radioList={DYJD}
                  />
                )}
              </>
            );
          },
        },
        {
          label: '确认第二阶段成交供应商方式',
          field: 'executeStyle',
          component: 'Render',
          colSpan: 2,
          ishidden: tableType == BJKJ() || tableType == KJXYCG() ? false : true,
          slotRender: (text: string = '0') => {
            let name = <span style={{ paddingLeft: 8, color: '#ccc' }}>--</span>;
            if (text == '0') {
              name = <span style={{ paddingLeft: 8 }}>直接选定方式</span>;
            } else if (text == '1') {
              name = <span style={{ paddingLeft: 8 }}>二次竞价方式</span>;
            } else if (text == '2') {
              name = <span style={{ paddingLeft: 8 }}>顺序轮候方式</span>;
            }

            return (
              <>
                {disabled ? (
                  name
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'executeStyle'}
                    onChange={(value) => {
                      changeRadio(value, 'executeStyle');
                    }}
                    defalultKeys={Number(text)}
                    radioDisabled={disabled}
                    radioList={[
                      {
                        value: 0,
                        name: '直接选定方式',
                      },
                      {
                        value: 1,
                        name: '二次竞价方式',
                      },
                      {
                        value: 2,
                        name: '顺序轮候方式',
                      },
                    ]}
                  />
                )}
              </>
            );
          },
        },
      ],
    },
    {
      key: 'PurchasingRequirements',
      title: '合同范本及采购需求',
      fieldChildren: [
        {
          label: '统一合同范本',
          field: 'templateFlag',
          component: 'Render',
          colSpan: 1,
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '是';
            } else {
              name = '否';
            }
            return (
              <>
                {disabled ? (
                  <span style={{ paddingLeft: 8 }}>{name}</span>
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'templateFlag'}
                    defalultKeys={Number(text)}
                    onChange={(value) => {
                      changeRadio(value, 'templateFlag');
                    }}
                    radioList={[
                      {
                        value: 1,
                        name: '是',
                      },
                      {
                        value: 0,
                        name: '否',
                      },
                    ]}
                    radioDisabled={disabled}
                  />
                )}
              </>
            );
          },
        },
        {
          label: '合同范本',
          field: 'contractURL',
          component: 'Render',
          placeholder: disabled ? '--' : '请选择',
          message: '请选择合同范本',
          disabled: true,
          required: true,
          colSpan: Number(radioState.templateFlag) == 1 ? 1 : 0,
          ishidden: Number(radioState.templateFlag) == 1 ? false : true,
          contentAfter: (
            <a
              onClick={() => {
                setIsShow(true);
              }}
            >
              <SearchOutlined />
            </a>
          ),
          slotRender: (text, record) => {
            return (
              <>
                <div className="criteria-btnStyle">
                  <div style={{ flex: 'auto', alignItems: 'center', marginLeft: '8px' }}>
                    {radioState?.contractURL ? (
                      <div style={{ padding: '10px 0' }}>
                        {renderFileFunc({ record: radioState, fileName: 'contractURL', downloadAddress: '/contractTemplateController/downloadFile' })}
                      </div>
                    ) : (
                      <Form.Item
                        name="contractURL"
                        rules={[
                          {
                            required: true,
                            message: '请选择',
                          },
                        ]}
                      >
                        <Input placeholder="范本名称" readOnly />
                      </Form.Item>
                    )}
                    {}
                  </div>
                  <div className="criteria-btnStyle-bottomIcon">
                    <a
                      onClick={() => {
                        setIsShow(true);
                      }}
                    >
                      <SearchOutlined />
                    </a>
                  </div>
                </div>
              </>
            );

            // radioState
          },
        },
        {
          label: '合同文本',
          field: 'contractURL',
          component: 'Render',
          required: true,
          colSpan: Number(radioState.templateFlag) == 0 ? 1 : radioState?.templateFlag == undefined ? 1 : 0,
          ishidden: Number(radioState.templateFlag) == 0 ? false : radioState?.templateFlag == undefined ? false : true,
          slotRender: (text) => {
            const fileName = 'contractURL';
            return (
              <div className="criteria-btnStyle">
                <div style={{ flex: 'auto', alignItems: 'center', padding: '5px 0' }}>
                  {!disabled ? (
                    <div style={{ width: 'fit-content' }}>
                      <UploadFormCommon
                        form={formRef}
                        fileFormName={fileName}
                        spanCol={24}
                        inRowProportion={24}
                        name={'attachFile'}
                        required={true}
                        accept={'.doc|.docx'}
                        url={'/purchaseSourceController/uploadFile'}
                        downloadUrl={'/purchaseSourceController/downloadFile'}
                        fileFormDelName={'delFile'}
                        maxFile={1}
                        delFunc={(delFilePath: string) => {
                          handleDelFileFn(delFilePath, fileName);
                        }}
                        uploadSuccessCallback={(attachPaths) => {
                          handleAddFileFn(attachPaths, fileName);
                        }}
                        defaultFiles={text}
                        hintTitle={'且只能上传 1 个！'}
                        fieldBusiPath={'purchase/source'}
                        // isShowUploadBtn={true}
                      >
                        上传
                      </UploadFormCommon>
                    </div>
                  ) : (
                    <div
                      style={{
                        height: '100%',
                        display: 'flex',
                        alignItems: 'center',
                        marginLeft: '8px',
                      }}
                    >
                      {radioState?.[fileName] ? (
                        splitFileUrl(radioState?.[fileName])?.map((e) => {
                          return (
                            <Tooltip title={e.attachName} key={new Date().getTime() * 25615265152 + e?.attachName}>
                              <a
                                onClick={() => {
                                  message.success('下载中，请稍后...');
                                  downloadTemplate('/purchaseSourceController/downloadFile', e?.attachName, e?.attachUrl, () => {});
                                }}
                              >
                                <MyIcon type="icon-file-text-fill" />
                                &nbsp;
                                {getFileNameNotType(e.attachName, 8)}
                              </a>
                            </Tooltip>
                          );
                        })
                      ) : (
                        <span style={{ color: '#ccc' }}>--</span>
                      )}
                    </div>
                  )}
                </div>
                {/* <div className="criteria-btnStyle-bottomIcon">
                  <a onClick={() => {}}>
                    <Tooltip title={`下载模板`}>
                      <VerticalAlignBottomOutlined />
                    </Tooltip>
                  </a>
                </div> */}
              </div>
            );
          },
        },
        {
          label: '采购需求',
          field: 'needFileURL',
          component: 'Render',
          colSpan: 2,
          required: true,
          slotRender: (text) => {
            const fileName = 'needFileURL';
            return (
              <>
                {!disabled ? (
                  <div>
                    <UploadFormCommon
                      form={formRef}
                      fileFormName={fileName}
                      spanCol={24}
                      inRowProportion={24}
                      name={'attachFile'}
                      required={true}
                      accept={'.doc|.docx'}
                      url={'/purchaseSourceController/uploadFile'}
                      downloadUrl={'/purchaseSourceController/downloadFile'}
                      fileFormDelName={'delFile'}
                      maxFile={1}
                      delFunc={(delFilePath: string) => {
                        handleDelFileFn(delFilePath, fileName);
                      }}
                      uploadSuccessCallback={(attachPaths) => {
                        handleAddFileFn(attachPaths, fileName);
                      }}
                      defaultFiles={text}
                      hintTitle={'且只能上传 1 个！'}
                      fieldBusiPath={'purchase/source'}
                      // isShowUploadBtn={true}
                    >
                      上传
                    </UploadFormCommon>
                  </div>
                ) : (
                  <div
                    style={{
                      height: '100%',
                      display: 'flex',
                      alignItems: 'center',
                      marginLeft: '8px',
                    }}
                  >
                    {radioState?.[fileName] ? (
                      splitFileUrl(radioState?.[fileName])?.map((e) => {
                        return (
                          <Tooltip title={e.attachName} key={new Date().getTime() * 25615265152 + e?.attachName}>
                            <a
                              onClick={() => {
                                message.success('下载中，请稍后...');
                                downloadTemplate('/purchaseSourceController/downloadFile', e?.attachName, e?.attachUrl, () => {});
                              }}
                            >
                              <MyIcon type="icon-file-text-fill" />
                              &nbsp;
                              {getFileNameNotType(e.attachName, 8)}
                            </a>
                          </Tooltip>
                        );
                      })
                    ) : (
                      <span style={{ color: '#ccc' }}>--</span>
                    )}
                  </div>
                )}
              </>
            );
          },
        },
      ],
    },
    {
      key: 'OtherRequirements',
      title: '其他要求',
      fieldChildren: [
        {
          label: '是否现场考察',
          field: 'siteVisitFlag',
          component: 'Render',
          colSpan: radioState.siteVisitFlag == 0 ? 2 : 1,
          ishidden: tableType == BJKJ() || tableType == BJXJ() || tableType == BJCS() || tableType == DYLY() || tableType == XJCG() || tableType == JZXTP(),
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '组织';
            } else {
              name = '不组织';
            }
            return (
              <>
                {disabled ? (
                  <span style={{ paddingLeft: 8 }}>{name}</span>
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'siteVisitFlag'}
                    onChange={(value) => {
                      changeRadio(value, 'siteVisitFlag');
                    }}
                    defalultKeys={Number(text)}
                    radioDisabled={disabled}
                    radioList={[
                      {
                        value: 1,
                        name: '组织',
                      },
                      {
                        value: 0,
                        name: '不组织',
                      },
                    ]}
                  />
                )}
              </>
            );
          },
        },
        {
          label: '考察时间',
          field: 'siteVisitTime',
          placeholder: '请选择',
          component: 'Render',
          required: true,
          colSpan: radioState.siteVisitFlag == 0 ? 0 : 1,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            radioState.siteVisitFlag == 0
              ? true
              : false,
          slotRender: (text) => {
            if (disabled) {
              return <div style={{ marginLeft: '8px' }}>{text ? moment(text)?.format('YYYY-MM-DD') : <span style={{ color: '#ccc' }}>--</span>}</div>;
            } else {
              return (
                <>
                  <Form.Item
                    name={'siteVisitTime'}
                    rules={[
                      {
                        required: true,
                        message: '请选择',
                      },
                    ]}
                  >
                    <DatePicker />
                  </Form.Item>
                </>
              );
            }
          },
        },
        {
          label: '考察地点',
          field: 'siteVisitAddress',
          maxLength: 200,
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          allowClear: true,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          required: true,
          colSpan: radioState.siteVisitFlag == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            radioState.siteVisitFlag == 0
              ? true
              : false,
          disabled,
        },
        {
          label: '开标前答疑会',
          field: 'meetFlag',
          component: 'Render',
          colSpan: radioState.meetFlag == 0 ? 2 : 1,
          ishidden: tableType == BJKJ() || tableType == BJXJ() || tableType == BJCS() || tableType == DYLY() || tableType == XJCG() || tableType == JZXTP(),
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '召开';
            } else {
              name = '不召开';
            }

            return (
              <>
                {disabled ? (
                  <span style={{ paddingLeft: 8 }}>{name}</span>
                ) : (
                  <TagSelect
                    colSpan={24}
                    formLabel={''}
                    formName={'meetFlag'}
                    onChange={(value) => {
                      changeRadio(value, 'meetFlag');
                    }}
                    radioDisabled={disabled}
                    defalultKeys={Number(text)}
                    radioList={[
                      {
                        value: 1,
                        name: '召开',
                      },
                      {
                        value: 0,
                        name: '不召开',
                      },
                    ]}
                  />
                )}
              </>
            );
          },
        },
        {
          label: '召开时间',
          field: 'meetTime',
          placeholder: '请选择',
          component: 'Render',
          required: true,
          colSpan: radioState.meetFlag == 0 ? 0 : 1,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            radioState.meetFlag == 0
              ? true
              : false,
          slotRender: (text) => {
            if (disabled) {
              return <div style={{ marginLeft: '8px' }}>{text ? moment(text)?.format('YYYY-MM-DD') : <span style={{ color: '#ccc' }}>--</span>}</div>;
            } else {
              return (
                <>
                  <Form.Item name={'meetTime'} rules={[{ required: true, message: '请选择' }]}>
                    <DatePicker />
                  </Form.Item>
                </>
              );
            }
          },
        },
        {
          label: '召开地点',
          field: 'meetAddress',
          maxLength: 200,
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          allowClear: true,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          required: true,
          disabled,
          colSpan: radioState.meetFlag == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            radioState.meetFlag == 0
              ? true
              : false,
        },
        {
          label: '是否需要样品',
          field: 'sampleFlag',
          component: 'Render',
          colSpan: radioState.sampleFlag == 0 ? 2 : 1,
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '需要';
            } else {
              name = '不需要';
            }

            if (disabled) {
              return <span style={{ paddingLeft: 8 }}>{name}</span>;
            } else {
              return (
                <TagSelect
                  colSpan={24}
                  formLabel={''}
                  onChange={(value) => {
                    changeRadio(value, 'sampleFlag');
                  }}
                  formName={'sampleFlag'}
                  defalultKeys={Number(text)}
                  radioDisabled={disabled}
                  radioList={[
                    {
                      value: 1,
                      name: '需要',
                    },
                    {
                      value: 0,
                      name: '不需要',
                    },
                  ]}
                />
              );
            }
          },
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS(),
        },
        {
          label: '相关检测报告',
          field: 'sampleCheck',
          component: 'Render',
          colSpan: radioState.sampleFlag == 0 ? 0 : 1,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS() ||
            radioState.sampleFlag == 0
              ? true
              : false,
          slotRender: (text: string = '0') => {
            let name = '';
            if (text == '1') {
              name = '需要';
            } else {
              name = '不需要';
            }

            if (disabled) {
              return <span style={{ paddingLeft: 8 }}>{name}</span>;
            } else {
              return (
                <TagSelect
                  colSpan={24}
                  formLabel={''}
                  formName={'sampleCheck'}
                  onChange={(value) => {
                    changeRadio(value, 'sampleCheck');
                  }}
                  radioDisabled={disabled}
                  defalultKeys={Number(text)}
                  radioList={[
                    {
                      value: 1,
                      name: '需要',
                    },
                    {
                      value: 0,
                      name: '不需要',
                    },
                  ]}
                />
              );
            }
          },
        },
        {
          label: '样品制作的标准和要求',
          field: 'sampleMake',
          maxLength: 200,
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          allowClear: true,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          required: true,
          disabled,
          colSpan: radioState.sampleFlag == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS() ||
            radioState.sampleFlag == 0
              ? true
              : false,
        },
        {
          label: '未中标人样品退还',
          field: 'sampleReturn',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          allowClear: true,
          maxLength: 200,
          required: true,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          disabled,
          colSpan: radioState.sampleFlag == 0 ? 0 : radioState.sampleCheck == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS() ||
            radioState.sampleFlag == 0
              ? true
              : radioState.sampleCheck == 0
              ? true
              : false,
        },
        {
          label: '中标人样品保管、封存及退还',
          field: 'sampleSeal',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          allowClear: true,
          maxLength: 200,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          required: true,
          disabled,
          colSpan: radioState.sampleFlag == 0 ? 0 : radioState.sampleCheck == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS() ||
            radioState.sampleFlag == 0
              ? true
              : radioState.sampleCheck == 0
              ? true
              : false,
        },
        {
          label: '样品递交要求',
          field: 'sampleDeliver',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          allowClear: true,
          maxLength: 200,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          required: true,
          disabled,
          colSpan: radioState.sampleFlag == 0 ? 0 : radioState.sampleCheck == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS() ||
            radioState.sampleFlag == 0
              ? true
              : radioState.sampleCheck == 0
              ? true
              : false,
        },
        {
          label: '样品其他要求',
          field: 'sampleOther',
          component: 'InputTextArea',
          placeholder: disabled ? '--' : '请输入',
          maxLength: 200,
          allowClear: true,
          autoSize: { minRows: 3, maxRows: 4 },
          showCount: true,
          disabled,
          colSpan: radioState.sampleFlag == 0 ? 0 : radioState.sampleCheck == 0 ? 0 : 2,
          ishidden:
            tableType == BJKJ() ||
            tableType == BJXJ() ||
            tableType == BJCS() ||
            tableType == DYLY() ||
            tableType == XJCG() ||
            tableType == JZXTP() ||
            tableType == JZXCS() ||
            radioState.sampleFlag == 0
              ? true
              : radioState.sampleCheck == 0
              ? true
              : false,
        },
        {
          label: '履约保证金',
          field: 'bidMarginFlag',
          component: 'Render',
          colSpan: 2,
          ishidden: tableType == KJXYCG(),
          slotRender: (text: string = '1') => {
            let name = '';
            if (text == '1') {
              name = '缴纳';
            } else {
              name = '不缴纳';
            }
            if (disabled) {
              return <span style={{ paddingLeft: 8 }}>{name}</span>;
            } else {
              return (
                <TagSelect
                  colSpan={24}
                  formLabel={''}
                  formName={'bidMarginFlag'}
                  onChange={(value) => {
                    changeRadio(value, 'bidMarginFlag');
                  }}
                  defalultKeys={Number(text)}
                  radioDisabled={disabled}
                  radioList={[
                    {
                      value: 1,
                      name: '缴纳',
                    },
                    {
                      value: 0,
                      name: '不缴纳',
                    },
                  ]}
                />
              );
            }
          },
        },
        {
          label: '合同金额的',
          field: 'bidMargin',
          component: 'InputNumber',
          placeholder: disabled ? '--' : '不得超过10%',
          type: 'number',
          contentAfter: '%',
          min: 0,
          max: 10,
          step: '0.01',
          required: true,
          colSpan: radioState?.bidMarginFlag == 0 || radioState?.bidMarginFlag == null ? 0 : 1,
          ishidden: tableType == KJXYCG() || radioState?.bidMarginFlag == 0 || radioState?.bidMarginFlag == null ? true : false,
          disabled,
          slotRender: (text, record) => {
            let { bidMargin } = radioState;
            // 当超出预算金额时提示
            let ishow = Number(bidMargin) <= 10 ? false : true;
            return (
              <>
                {disabled ? (
                  <span style={{ paddingLeft: 8 }}>{bidMargin ? bidMargin : ''}</span>
                ) : (
                  <div style={{ display: 'flex', alignItems: 'center', height: '100%', width: '100%' }}>
                    <div style={{ display: 'flex', flexDirection: 'column', height: '100%', flex: 'auto' }}>
                      <Form.Item name="bidMargin" rules={[{ required: true, message: '请填写合同金额' }]}>
                        <InputNumber
                          status={ishow ? 'error' : ''}
                          bordered={ishow ? true : false}
                          value={bidMargin}
                          placeholder={disabled ? '--' : '不得超过10%'}
                          controls={false}
                          style={{ paddingLeft: '5px' }} //width: '430px', maxWidth: '430px', minWidth: '100px',
                          onChange={(value: any) => {
                            changeRadio(value, 'bidMargin');
                            changeInfo(value, 'bidMargin');
                          }}
                        />
                      </Form.Item>
                      {ishow && <span style={{ color: 'red', flex: '.5', paddingLeft: 8, fontSize: '14px' }}>不能超过10%</span>}
                    </div>
                    <div
                      style={{
                        minWidth: '43px',
                        maxWidth: '100px',
                        height: '100%',
                        color: 'rgba(0, 0, 0, 0.85)',
                        display: 'flex',
                        alignItems: 'center',
                        justifyContent: 'center',
                        borderLeft: '1px solid #f0f0f0',
                        backgroundColor: '#fafafa',
                        cursor: 'pointer',
                      }}
                    >
                      %
                    </div>
                  </div>
                )}
              </>
            );
          },
        },
        {
          label: '缴纳时间',
          field: 'bidMarginTime',
          placeholder: '请选择',
          component: 'Render',
          required: true,
          colSpan: radioState?.bidMarginFlag == 0 || radioState?.bidMarginFlag == null ? 0 : 1,
          ishidden: tableType == KJXYCG() || radioState?.bidMarginFlag == 0 || radioState?.bidMarginFlag == null ? true : false,
          slotRender: (text, record) => {
            if (disabled) {
              return <div style={{ marginLeft: '8px' }}>{text ? text : <span style={{ color: '#ccc' }}>--</span>}</div>;
            } else {
              return (
                <>
                  <Form.Item
                    name={'bidMarginTime'}
                    rules={[
                      {
                        required: true,
                        message: '请输入',
                      },
                    ]}
                  >
                    <Input placeholder="请输入缴纳时间" />
                  </Form.Item>
                </>
              );
            }
          },
        },
      ],
    },
  ];

  /**政府集中采购只要第一项和最后一项*/
  if (infoState?.procureOrg == ZFJZCG()) {
    columns = [columns?.[0]];
  }

  return columns;
};

export const tenderDocumentsColumnsUpdateConfig = ({ change, state, cardType, formRef }) => {
  const { handleDelFileFn, handleAddFileFn, onOpenReadOfdWord } = change;

  const { radioState, infoState } = state;

  let tableType;
  if (infoState?.id && infoState?.procureOrg == SYSZX()) {
    //实验室自行组织采购
    tableType = infoState?.procureReal;
  } else if (infoState?.id && infoState?.procureOrg == ZFJZCG()) {
    //政府集中采购
    tableType = GKZB();
  }

  let disabled = false;

  if (cardType == 'view') disabled = true;
  if (cardType == 'edit') disabled = false;

  let columns = [
    {
      key: 'FormalTenderDocument',
      title: '正式招标采购文件',
      fieldChildren: [
        {
          label: '正式招标采购文件',
          field: 'busiFileURL',
          component: 'Render',
          colSpan: 2,
          slotRender: (text) => {
            const fileName = 'busiFileURL';
            return (
              <>
                {!disabled ? (
                  <div>
                    <UploadFormCommon
                      form={formRef}
                      fileFormName={fileName}
                      spanCol={24}
                      inRowProportion={24}
                      name={'attachFile'}
                      required={false}
                      accept={'.doc|.docx'}
                      url={'/purchaseSourceController/uploadFile'}
                      downloadUrl={'/purchaseSourceController/downloadFile'}
                      fileFormDelName={'delFile'}
                      maxFile={1}
                      delFunc={(delFilePath: string) => {
                        handleDelFileFn(delFilePath, fileName);
                      }}
                      uploadSuccessCallback={(attachPaths) => {
                        handleAddFileFn(attachPaths, fileName);
                      }}
                      defaultFiles={text}
                      hintTitle={'且只能上传 1 个！'}
                      fieldBusiPath={'purchase/source'}
                      isEdit={true}
                      onOpenReadOfdWord={onOpenReadOfdWord}
                      // isShowUploadBtn={true}
                    >
                      上传
                    </UploadFormCommon>
                  </div>
                ) : (
                  <div
                    style={{
                      height: '100%',
                      display: 'flex',
                      alignItems: 'center',
                      marginLeft: '8px',
                    }}
                  >
                    {radioState?.[fileName] ? (
                      splitFileUrl(radioState?.[fileName])?.map((e) => {
                        return (
                          <>
                            <Tooltip title={e.attachName}>
                              <a
                                onClick={() => {
                                  message.success('下载中，请稍后...');
                                  downloadTemplate('/purchaseSourceController/downloadFile', e?.attachName, e?.attachUrl, () => {});
                                }}
                              >
                                <MyIcon type="icon-file-text-fill" />
                                &nbsp;
                                {getFileNameNotType(e.attachName, 8)}
                              </a>
                            </Tooltip>
                            <Tooltip title="在线查看">
                              <div style={{ margin: '0 8px' }}>
                                <a onClick={() => onOpenReadOfdWord(radioState?.busiFileURL)}>
                                  <EyeOutlined />
                                </a>
                              </div>
                            </Tooltip>
                          </>
                        );
                      })
                    ) : (
                      <span style={{ color: '#ccc' }}>--</span>
                    )}
                  </div>
                )}
              </>
            );
          },
        },
      ],
    },
  ];

  // if (infoState?.procureOrg == ZFJZCG()) {
  //   columns = [columns?.[0], columns?.[columns?.length - 1]];
  // }

  return columns;
};
